using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace OnlineAnadolu
{
    public partial class SifremiDegistir : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Session["usertype"].ToString() == "")
            {
                Response.Redirect("HataSayfasi.aspx");
            }
            
        }

        protected void ChangePasswordPushButton_Click(object sender, EventArgs e)
        {

      
        }

        protected void CancelPushButton_Click(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

           



             




        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            if ((Session["password"].ToString() != TextBox1.Text))
            {
                lb_Uyari.Text = "Eski Sifre hatali";
            }

            if(TextBox2.Text != TextBox3.Text)
            {
                lb_Uyari.Text = "Sifreler Uyusmuyor";

            }
            if ((Session["password"].ToString() == TextBox1.Text) && (TextBox2.Text == TextBox3.Text))
            {
                string query = "UPDATE users SET password=N'" + TextBox2.Text + "' where user_name=N'" + Session["username"].ToString() + "'";
                Database db = new Database();
                db.insert(query);
                Session["password"]=TextBox3.Text;
                lb_Uyari.Text = "Sifreniz Guncellendi";
            }
         

        }
    }
}
